package qc.module.platform.api.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import qc.module.platform.dto.config.ConfigDto;
import qc.module.platform.dto.config.ConfigQueryConditionDto;
import qc.module.platform.service.ProjectConfigsService;

import java.util.List;

/**
 * ConfigController
 *
 * @author QuCheng Tech
 * @create 2023/1/9
 */
@RestController
@RequestMapping("/config")
public class ConfigController {
    private ProjectConfigsService projectConfigsService;

    @Autowired
    public void setProjectConfigsService(ProjectConfigsService projectConfigsService) {
        this.projectConfigsService = projectConfigsService;
    }

    /**
     * 根据传入对象信息查询配置信息，不判断项目状态和配置信息状态
     *
     * @param dto ConfigQueryConditionDto
     * @return 配置信息集合
     * @author QcCheng Tech
     * @since 2023/2/7
     */
    @RequestMapping(value = "/query", method = {RequestMethod.GET, RequestMethod.POST})
    public List<ConfigDto> query(@RequestBody ConfigQueryConditionDto dto) throws Exception {
        return projectConfigsService.query(dto, false);
    }
}
